<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>19.1. Core Mechanism and Applications</title>
		<link type="text/css" rel="stylesheet" href="PLUGINS_ROOT/org.polarsys.capella.doc/html/styles.css"/>
	</head>
	<body>
		<h1 id="Command_Line_Support">Command Line Support</h1>
		<h2 id="Overview">Overview</h2>
		<p>Capella provides the capacity to launch actions from command line. Potential actions are Model Validation, Model Migration, HTML Production, Refresh Representations, Remove Hidden Elements from Representations and Export Representations as Images.</p>
		<p>The core mechanism provides the following parameters:</p>
		<table id="commonParameters">
			<tr>
				<th>Name</th>
				<th>Category</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>appid</td>
				<td>mandatory</td>
				<td>defines the id of the command line application to launch. Command line applications are plugins that extend the core mechanism (e.g. model validation)</td>
			</tr>
			<tr>
				<td>data</td>
				<td>optional</td>
				<td>defines the path to the workspace</td>
			</tr>
			<tr>
				<td>input</td>
				<td>mandatory</td>
				<td>defines a list of the relative paths (to the workspace) of the Eclipse projects or aird files to use as input of the command line. The list have to be placed into quotes "" and separated by a &#124; character. Use /all to specify that all projects in the workspace are used as input.</td>
			</tr>
			<tr>
				<td>import</td>
				<td>optional</td>
				<td>defines a list of the path of the Eclipse projects to import into the workspace before doing the actual job. The list have to be placed into quotes "" and separated by a &#124; character</td>
			</tr>
			<tr>
				<td>forceimport</td>
				<td>optional</td>
				<td>unreference/delete exiting project from the workspace while importing projects using command line. Without this option, an error is logged if a project with the same name than the imported project exists already in the workspace</td>
			</tr>
			<tr>
				<td>outputfolder</td>
				<td>optional</td>
				<td>defines the relative path (to the workspace) of the output folder</td>
			</tr>
			<tr>
				<td>exportZip</td>
				<td>optional</td>
				<td>defines a list of the relative paths of the Eclipse projects to export as zip. The list have to be placed into quotes "" and separated by a &#124; character. Use /all to specify that all projects in the workspace are exported. This parameter must be used with -outputfolder to specify the folder that contains the zips.</td>
			</tr>
			<tr>
				<td>nosplash</td>
				<td>optional</td>
				<td>launch Capella without the initial splash screen</td>
			</tr>
			<tr>
				<td>consolelog</td>
				<td>optional</td>
				<td>allows to send additional log messages (e.g. exceptions) into the console output</td>
			</tr>
			<tr>
				<td>logfile</td>
				<td>optional</td>
				<td>defines the path to the log file (if not specified, log file is created in the workspace directory with the name MDEReport.html)</td>
			</tr>
			<tr>
				<td>help</td>
				<td>optional</td>
				<td>prints the help message</td>
			</tr>
		</table>
		<p>
			<br/>
		</p>
		<table border="1">
			<tr>
				<td>
					<p>
						<img height="48" width="48" border="0" src="Images/19.1. Core Mechanism &amp; Applications_html_3c78e175.png"/>
					</p>
				</td>
				<td>
					<p><ul>
<li>When using custom scripts, some arguments may be modified in live. This can cause issues when using paths starting with a "/". If it occurs, try removing the leading "/" from the paths used as arguments.</li>
						<br/>
<li>Default behaviour of command line support checks that the workspace specified for use in command line is not in use by another instance of Eclipse.</li>
						<br/>
<li>If the path to the aird file or the path to the workspace or the path to the log file contains white space, it should be in quotes (eg: 
						<b>-data &ldquo;D: /Application Data/workspace&rdquo;)</b></li>
						<br/>
<li>When Capella is run in command line, logs levels INFO, WARN, ERROR, FATAL are automatically activated for File and Console appender (regardless of the current log configuration stored in %USERPROFILE%/ReportConfiguration.xml)</li>
						<br/>
<li>Before running below commands make sure to not have newline between each parameters to avoid copy/paste errors.</li>
</ul>
					</p>
				</td>
			</tr>
		</table>
		<h2 id="Command_Line_Application_Examples">Command Line Application Examples</h2>
		<h3 id="Model_Validation">Model Validation</h3>
		<p>The model validation command line provides the following additional parameters:</p>
		<table id="validationParameters">
			<tr>
				<th>Name</th>
				<th>Category</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>outputfolder</td>
				<td>mandatory</td>
				<td>defines the path to the output folder to generate the validation report.</td>
			</tr>
			<tr>
				<td>validationruleset</td>
				<td>optional</td>
				<td>defines path to the epf file of the disalbed rule IDs</td>
			</tr>
			<tr>
				<td>validationcontext</td>
				<td>optional</td>
				<td>defines the list of path to objects to validate</td>
			</tr>
			<tr></tr>
		</table>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.validation.commandline
-data &lt;workspacePath&gt;
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder /DocProject/validation
-logfile D:/CommandLineLog/log.html
</pre>
		<p>
			<br/>
		</p>
		<p>This command validates the model corresponding to the 
			<i>&lt;workspacePath&gt;</i>/EOLE_AF/EOLE_AF.aird file and generates a report to the output folder 
			<i>&lt;workspacePath&gt;</i>/DocProject/validation. 
		</p>
		<p>
			<b>
				<i>DocProject</i>
			</b> must be a general Eclipse project (not a directory) initially created into the specified workspace, with inside a folder named 
			<b>
				<i>validation</i>
			</b>. As well, 
			<b>
				<i>EOLE_AF</i>
			</b> must exist as Capella project inside the same workspace.
			A log file can be also specified with the parameter 
			<b>
				<i>-logfile</i>
			</b>
		</p>
		<p><u>
			<b>Complex use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.validation.commandline
-input /EOLE_AF/EOLE_AF.aird
-outputfolder /DocProject/validation
-validationruleset D:/EPF/exportall.epf
-validationcontext "EOLE_AF/EOLE_AF.capella#971d9934-9780-4e41-b02e-312d0eac3223 | EOLE_AF EOLE_AF/fragments/OA-Operational%20Context-Operational%20Entity.capellafragment#c6aebe52-c8a4-4d35-8105-177c87470bef"
-data &lt;workspacePath&gt;
-logfile D:/CommandLineLog/log.html
</pre>
		<p>This new command uses a 
			<b>
				<i>-validationruleset</i>
			</b> parameter to specify the path to an Eclipse Property File (epf file) and a 
			<b>
				<i>-validationcontext</i>
			</b> parameter to specify the set of URIs of model elements to validate. The set of rule to validate against are stored into the exported epf file.
		</p>
		<p>The parameter 
			<b>
				<i>-forceoutputfoldercreation</i>
			</b> becomes necessary for the following cases :
		</p>
		<ul>
			<li>If 
				<b>
					<i>validation</i>
				</b> folder does not exist and 
				<i>DocProject</i> already exist, then it will be created inside 
				<i>DocProject</i>
			</li>
			<li>If either 
				<b>
					<i>validation</i>
				</b> folder and 
				<b>
					<i>DocProject</i>
				</b> do not exist, then 
				<b>
					<i>DocProject</i>
				</b> will be created as well 
				<b>
					<i>validation</i>
				</b> folder inside it.
			</li>
		</ul>
		<p>A log file is also specified.</p>
		<h3 id="Export_as_ZIP_.28Deprecated.2C_use_the_parameter_-exportZip_instead.29">Export as ZIP (Deprecated, use the parameter -exportZip instead)</h3>
		<p>This command will export selected project to the given zip filename</p>
		<p>Mandatory parameters:</p>
		<ul>
			<li>export: defines the project name to export as zip</li>
		</ul>
		<ul>
			<li>exportZipName: a relative path to the output zip (path must be a relative path into the given 
				<b>
					<i>-data </i>
				</b> parameter)
			</li>
		</ul>
		<p>(usage of &ldquo;qualifier&rdquo; in the output file name will be replaced by current date/time)</p>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.core.commandline.core.exportZip
-data &lt;workspacePath&gt;
-export "EOLE_AF"
-exportZipName "/EOLE_AF/EOLE_qualifier.zip"
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"
-forceoutputfoldercreation
-logfile D:/CommandLineLog/log.html
</pre>
		<h3 id="Migration">Migration</h3>
		<table id="migrationParameters">
			<tr>
				<th>Name</th>
				<th>Category</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>backup</td>
				<td>optional</td>
				<td>whether the model is backed up during the migration.</td>
			</tr>
		</table>
		<p>This command will migrate the project(s) given as input. A workspace folder is created and located where the command is triggered or in a specified path given by the 
			<i>-data</i> parameter. It creates a log file located in the .metadata folder of the workspace. If the input project is a folder, it will be backed up and migrated inside this folder, otherwise if the input is a zip file it will be unzipped and project(s) inside it will be migrated into the workspace folder.
		</p>
		<p>For a migration and post-migration script example, please check: 
			<a href="/wiki/../help/topic/org.polarsys.capella.commandline.doc/html/19.%20Command%20Line%20Support/19.2.%20Migration%20and%20Post-Migration%20script%20example.html" title="../help/topic/org.polarsys.capella.commandline.doc/html/19.%20Command%20Line%20Support/19.2.%20Migration%20and%20Post-Migration%20script%20example.html">Migration and Post-Migration script example</a>
		</p>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.migration
-data &lt;workspacePath&gt;
-import D:/Projects/EOLE_AF.zip
-input /all
-exportZip EOLE_AF
-outputfolder /MigratedProject/output
-backup
</pre>
		<p>This command imports a .zip into the specified workspace, migrate all projects inside and exported the migrated project as zip to the output folder.</p>
		<p>If you migrate a project using libraries, all dependent projects/libraries must be included and the sequence order matters.</p>
		<p>Consider the example below:</p>
		<ul>
			<li>Project1 (references) Library1 &amp; Library2</li>
			<li>Library1 (references) Library3</li>
			<li>Library2 (references) Library3</li>
		</ul>
		<p>The migration process must be done according to the following sequence:</p>
		<ol>
			<li>Library3</li>
			<li>Library1</li>
			<li>Library2</li>
			<li>Project1</li>
		</ol>
		<p>In such a case, the migration sequence can be done either by launching several unary migration commands on each project/library or by giving the whole sequence through the 
			<i>-import</i> parameter (using 
			<i>|</i> separator).
		</p>
		<p><u>
			<b>Complex use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.migration
-import "D:/Projects/Library3 | D:/Projects/Library1 | D:/Projects/Library2 | D:/Projects/Project1"
-input /all
-data &lt;workspacePath&gt;
-logfile D:/CommandLineLog/log.html
</pre>
		<p>This command migrates the given project/libraries and creates a log.html at the specified location.</p>
		<h3 id="Refresh_Representations">Refresh Representations</h3>
		<p>This command will refresh all representations. More information here: 
			<a href="/wiki/../help/topic/org.polarsys.capella.ui.doc/html/05.%20Diagram%20Management/5.1.%20Diagram%20concepts.html#Diagram_Refreshing_Strategies" title="../help/topic/org.polarsys.capella.ui.doc/html/05.%20Diagram%20Management/5.1.%20Diagram%20concepts.html#Diagram_Refreshing_Strategies">Diagram Refreshing Strategies</a>
		</p>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.refreshRepresentations
-data &lt;workspacePath&gt;
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"
</pre>
		<h3 id="Remove_Hidden_Elements_from_Representations">Remove Hidden Elements from Representations</h3>
		<table id="removeHiddenElementsParameters">
			<tr>
				<th>Name</th>
				<th>Category</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>unsyncDiags</td>
				<td>optional</td>
				<td>all the elements with Unsynchronizable and Not synchronized mappings will be removed from diagrams. if not, only elements with Not synchronized mappings will be removed from diagrams.</td>
			</tr>
		</table>
		<p>This command will remove all hidden elements of all representations. More information here: 
			<a href="/wiki/../help/topic/org.polarsys.capella.ui.doc/html/05.%20Diagram%20Management/5.2.%20Advanced%20Management%20of%20Diagrams.html#Removing_Hidden_Elements_from_Diagrams" title="../help/topic/org.polarsys.capella.ui.doc/html/05.%20Diagram%20Management/5.2.%20Advanced%20Management%20of%20Diagrams.html#Removing_Hidden_Elements_from_Diagrams">Removing Hidden Elements from Diagrams</a>
		</p>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.removeHiddenElements
-data &lt;workspacePath&gt;
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"
</pre>
		<h3 id="Export_Representations_as_Images">Export Representations as Images</h3>
		<table id="exportRepresentationsParameters">
			<tr>
				<th>Name</th>
				<th>Category</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>outputfolder</td>
				<td>mandatory</td>
				<td>defines the path to the output folder to export images.</td>
			</tr>
			<tr>
				<td>imageFormat</td>
				<td>optional</td>
				<td>allows to choose the images format: JPG (by default), PNG, SVG, BMP, GIF</td>
			</tr>
			<tr>
				<td>exportToHtml</td>
				<td>optional</td>
				<td>an html page for each images</td>
			</tr>
			<tr>
				<td>exportDecorations</td>
				<td>optional</td>
				<td>for exporting decorations</td>
			</tr>
		</table>
		<p>This command will export images of all representations to the given outputfolder. More information here: 
			<a href="/wiki/../help/topic/org.polarsys.capella.tipsandtricks.doc/html/Tips%20and%20tricks/13_Diagram%20Export%20and%20Printing/13_Diagram%20Export%20and%20Printing.html#Export_As_Image" title="../help/topic/org.polarsys.capella.tipsandtricks.doc/html/Tips%20and%20tricks/13_Diagram%20Export%20and%20Printing/13_Diagram%20Export%20and%20Printing.html#Export_As_Image">Export_As_Image</a>
		</p>
		<p><u>
			<b>Simple use case:</b></u>
		</p>
		<pre>
&lt;CapellaInstallationPath&gt;/capellac.exe -nosplash
-application org.polarsys.capella.core.commandline.core
-appid org.polarsys.capella.exportRepresentations
-data &lt;workspacePath&gt;
-input "/EOLE_AF/EOLE_AF.aird"
-outputfolder "/EOLE_AF/output"
</pre>
	</body>
</html>